<?php

/**
 *   52zll.top
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

$perpage = $var['perpage'] ? $var['perpage'] : 10;
$page = max(1, intval($_GET['page']));
$start = ($page - 1) * $perpage;
if($start < 0) $start = 0;

$get = array(
	'id' => 'dzapp_zhibo',
	'mod' => 'list',
	'ac' => $ac
);

if($ac == 'graphic'){
	
	$param = array();

	$count = C::t('#dzapp_zhibo#dzapp_zhibo_graphic')->count_by_search($param);
	if($count) {
		$query = C::t('#dzapp_zhibo#dzapp_zhibo_graphic')->fetch_all_by_search($param, $start, $perpage);
		foreach($query as $value) {
			$value['pic'] = $value['pic'] ? dzapp_pic_get($value['pic'], 'portal', 0, $_G['setting']['ftp']['on']) : 'static/image/common/nophoto.gif';
			$value['id'] = $value['graphic_id'];
			$list[] = $value;
		}
		$theurl = 'plugin.php?'.page_url($get);
		$multi = multi($count, $perpage, $page, $theurl);
	}
	
}else{
	$param = array();

	$count = C::t('#dzapp_zhibo#dzapp_zhibo_activity')->count_by_search($param);
	if($count) {
		$query = C::t('#dzapp_zhibo#dzapp_zhibo_activity')->fetch_all_by_search($param, $start, $perpage);
		foreach($query as $value) {
			$value['pic'] = $value['pic'] ? dzapp_pic_get($value['pic'], 'portal', 0, $_G['setting']['ftp']['on']) : 'static/image/common/nophoto.gif';
			$value['id'] = $value['activity_id'];
			$list[] = $value;
		}
		$theurl = 'plugin.php?'.page_url($get);
		$multi = multi($count, $perpage, $page, $theurl);
	}
}

$type = $_G['mobile'] ? 'wap' : 'pc';
$diy = $_G['mobile'] ? '' : 'diy:';
$path = $_G['cache']['dzapp_template'][$identifier][$type] ? $_G['cache']['dzapp_template'][$identifier][$type] : 'source/plugin/'.$identifier.'/template';
include template($diy.substr($identifier, 6).'_'.$mod, 0, $path);

?>